import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

const routes = [
	{
		path: "/detail",
		name: "Detail",
		component: () => import("@/views/detail/index"),
		meta: {
			isHideFooter: true,
		},
	},
	{
		path: "/index",
		name: "Index",
		component: () => import("@/views/index/index"),
	},
	{
		path: "/login",
		name: "Login",
		component: () => import("@/views/login/index"),
		meta: {
			isHideFooter: true,
		},
	},
	{
		path: "/search",
		name: "Search",
		component: () => import("@/views/search/SearchPage.vue")
	},

	{
		path: "/video/:indexType?",
		name: "Video",
		component: () => import("@/views/video/index"),
	},
	{
		path: "/",
		redirect: "/index",
	},
];
const createRouter = () =>
	new Router({
		// mode: 'history', // require service support
		scrollBehavior: () => ({ y: 0 }),
		// 一上来只加载常量路由表
		routes: routes,
	});

const router = createRouter();

export default router;
